<template>
  <a-config-provider>
    <router-view />
    <!-- <global-setting /> -->
  </a-config-provider>
</template>

<script lang="ts" setup>
// import { computed } from 'vue';
// import GlobalSetting from '@renderer/components/global-setting/index.vue'
import { useMenuState } from './store'
import { Modal } from '@arco-design/web-vue'
// import { decimalRound } from './utils/mixins'
// import useLocale from '@renderer/hooks/locale';

const menuParam = useMenuState()

// 关闭窗口的消息接口处理
if (window.electron) {
  const ipcRenderer = window.electron.ipcRenderer
  ipcRenderer.on('close-win', (_event, value) => {
    console.log(_event, value)
    if (menuParam.isEditData) {
      Modal.warning({
        title: '警告',
        content: '当前有未保存的修改，是否直接关闭？',
        okText: '确认',
        cancelText: '取消',
        simple: false,
        hideCancel: false,
        maskClosable: false,
        closable: false,
        onOk: () => {
          ipcRenderer.send('close-app', value)
        },
        onCancel: () => {}
      })
    } else {
      ipcRenderer.send('close-app', value)
    }
  })
}
</script>
<style lang="less">
.export-load {
  background-color: rgba(0, 0, 0, 0.5);
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0px;
  left: 0px;
  z-index: 5000;

  .load-box {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
  }
}
</style>
